/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package controller;

import java.awt.Image;
import java.io.IOException;
import java.net.URL;
import java.util.ArrayList;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.imageio.ImageIO;

/**
 *
 * @author pipo
 */
public class IconManager {
    
    private Image image;
    private String name;
    
    private static List<IconManager> PokemonIconList = new ArrayList<IconManager>();
    private static List<IconManager> CharacterIconList = new ArrayList<IconManager>();

    public static IconManager map = new IconManager("/map/map.jpg" , "map");
    public static IconManager attack = new IconManager("/pictures/attack.png" , "attack");

    //POKEMON ICONS


            
            public IconManager(String filePath , String name)
            {
       
                URL charIcon = this.getClass().getResource(filePath);
                try{
                    this.image = ImageIO.read(charIcon);
                    this.name = name;
                } catch(IOException ex) {
                    Logger.getLogger(mainGame.GameEngine.class.getName()).log(Level.SEVERE, null, ex);
                } 
            }
            
            public static void populatePokemonIconList()
            {
                IconManager charmeleon  = new IconManager("/pictures/charmeleon.png" , "Charmeleon");
                IconManager pikachu = new IconManager("/pictures/pikachu.png", "Pikachu");
                IconManager fakechu = new IconManager("/pictures/fakechu.png", "Fakechu");
                IconManager fbb = new IconManager("/pictures/fancybabyfox.png","Fancy Baby Fox");
                IconManager fpt = new IconManager("/pictures/fireponything.png", "Fire Pony Thing");
                IconManager skypi = new IconManager("/pictures/skypi.png", "Skypi");
                IconManager fmp = new IconManager("/pictures/fatmutantpacman.png", "Fat Mutant Pacman");
                IconManager hm = new IconManager("/pictures/hornymouse.png", "Horny Mouse");
                IconManager hypno = new IconManager("/pictures/hypno.png", "Hypno");
                IconManager boner = new IconManager("/pictures/boner.png", "Boner");  
                IconManager bp = new IconManager("/pictures/burningpenguin.png", "Burning Penguin");
                IconManager kk = new IconManager("/pictures/karatekid.png", "Karate Kid");
                IconManager meaw = new IconManager("/pictures/meaw.png", "Meaw");
                IconManager nm = new IconManager("/pictures/ninjamonkey.png", "Ninja Monkey");
                IconManager onix = new IconManager("/pictures/onix.png", "Onix");
                IconManager squirtle = new IconManager("/pictures/squirtle.png", "Squirtle");
                IconManager td = new IconManager("/pictures/teddydog.png", "Teddy Dog");
                IconManager wappy = new IconManager("/pictures/wappy.png", "Wappy");
                IconManager wm = new IconManager("/pictures/wetmouse.png", "Wet Mouse");
                IconManager wormmy = new IconManager("/pictures/wormmy.png", "Wormmy");

                PokemonIconList.add(fmp); PokemonIconList.add(hm); PokemonIconList.add(hypno); PokemonIconList.add(boner); PokemonIconList.add(bp); PokemonIconList.add(kk);
                PokemonIconList.add(meaw); PokemonIconList.add(nm); PokemonIconList.add(onix); PokemonIconList.add(squirtle); PokemonIconList.add(td); PokemonIconList.add(wappy);
                PokemonIconList.add(charmeleon); PokemonIconList.add(wm); PokemonIconList.add(wormmy); PokemonIconList.add(skypi); PokemonIconList.add(fpt); PokemonIconList.add(fbb);
                PokemonIconList.add(pikachu); PokemonIconList.add(fakechu);
            
            }
            
            public static void populateCharacterIconList()
            {
                IconManager ash = new IconManager("/pictures/c0.png" , "c0");
                IconManager ruby = new IconManager("/pictures/c1.png" , "c1");
                IconManager dummyhead = new IconManager("/pictures/c2.png" ,"c2");
                IconManager broack = new IconManager("/pictures/c3.png" , "c3");
                
                IconManager e1 = new IconManager("/pictures/e1.png" , "Trainer1");
                IconManager e2 = new IconManager("/pictures/e2.png" , "Trainer2");
                IconManager e3 = new IconManager("/pictures/e3.png" , "Trainer3");
                IconManager e4 = new IconManager("/pictures/e4.png" , "Trainer4");
                IconManager e5 = new IconManager("/pictures/e5.png" , "Trainer5");
                IconManager e6 = new IconManager("/pictures/e6.png" , "Trainer6");
                IconManager e7 = new IconManager("/pictures/e7.png" , "Trainer7");
                IconManager e8 = new IconManager("/pictures/e8.png" , "Trainer8");
                IconManager e9 = new IconManager("/pictures/e9.png" , "Boss");

                IconManager trap = new IconManager("/pictures/trap.png" , "trap");
                CharacterIconList.add(ash);
                CharacterIconList.add(ruby);
                CharacterIconList.add(dummyhead);
                CharacterIconList.add(broack);
                
                CharacterIconList.add(e1);
                CharacterIconList.add(e2);
                CharacterIconList.add(e3);
                CharacterIconList.add(e4);
                CharacterIconList.add(e5);
                CharacterIconList.add(e6);
                CharacterIconList.add(e7);
                CharacterIconList.add(e8);
                CharacterIconList.add(e9);
                
                CharacterIconList.add(trap);


                
            }
                               
            public static Image returnImage(int index)
            {
                return PokemonIconList.get(index).image;
                
            }
            
            public String getName()
            {
                return this.name;
                
            }
            
            public static Image returnPokemonImage(String name)
            {
                for(IconManager m : PokemonIconList)
                {
                    if(m.getName().equals(name))
                        return m.image;
                    
                }
                
                return null;
                
            }
            
            public static Image returnCharacterImage(String name)
            {
                for(IconManager m : CharacterIconList)
                {
                    if(m.getName().equals(name))
                        return m.image;
                    
                }
                
                return null;
                
            }
            
            public Image returnImage()
            {
                return this.image;
                        
                
            }
    
}
